<?php 
/**************************************************
 *  MeatBallBot Web-Interface v0.4a               *
 *                                                *
 *  Licenced under the GPLv3                      *
 *                                                *
 *  Originally coded by HttpError (Jordan Songer) *
 **************************************************/ 
include("../inc/include.php");

//checks cookies to make sure they are logged in 
if(isset($_COOKIE['ID_my_site'])) 
{ 
$user = $_COOKIE['ID_my_site']; 
$pass = $_COOKIE['Key_my_site']; 
$check = mysql_query("SELECT * FROM users WHERE user = '$user'")or die(mysql_error()); 
while($info = mysql_fetch_array( $check )) 
{ 

//if the cookie has the wrong password, they are taken to the login page 
if ($pass != $info['password']) 
{ header("Location: ../index.php"); 
} 

//otherwise they are shown the admin area 
else 
{ 
echo "Welcome ".$info['dispname']."!<br>";
if ($info['admin'] >= 2)
  echo "Admin Area <img src=\"../img/icon_security.png\" /><br>";
echo "<a href=c_Register.php>Register a Channel</a>"; 
echo "<a href=../logout.php>Logout</a>"; 
} 
} 
} 
else 

//if the cookie does not exist, they are taken to the login screen 
{ 
header("Location: ../index.php"); 
} 
?>
